package model

import (
	"gorm.io/gorm"
	"time"
)

type BaseModel struct {
	Id        int            `gorm:"primaryKey;column:id" json:"id"`
	CreatedAt time.Time      `gorm:"column:createdAt"`
	UpdatedAt time.Time      `gorm:"column:updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"column:；" swaggertype:"string"` //time.Time 创建记录时，写入表时默认写入空值（内部字段为默认 空结构体） 而不是nil

}

//Admin
type Admin struct {
	BaseModel
	Aname string `gorm:"column:aname" json:"aname" binding:"required" validate:"min=1,max=32"` //用户名
	Apwd  string `gorm:"column:apwd" json:"apwd" binding:"required" validate:"min=5,max=128"`  //密码
}

// Student 学生信息
type Student struct {
	BaseModel
	Sno   string `gorm:"column:sno;unique" json:"sno" binding:"required" validate:"min=3,max=3"` //学号
	Spwd  string `gorm:"column:spwd" json:"spwd" binding:"required" validate:"min=4,max=32"`     //登陆密码
	Sname string `gorm:"column:sname" json:"sname"binding:"required" validate:"min=1,max=32"`    //姓名
}

// Token 令牌
type Token struct {
	Token string `json:"token"`
}
